Parameters are part of the method signature and its identity.
Overriding a method and changing one of its parameters' names will confuse and impact the method’s readability. In dart doc the consequences might be even worse. If an overriding method doesn’t provide ots own
documentation comment, it will inherit a comment from an overridden method. If the inherited comment contains a link to the parameter, which was
renamed, linking will fail.
abstract class BankAccount
{
void addMoney(int money);
}
class MyBankAccount extends BankAccount
{
void addMoney(int amount) // Noncompliant: parameter's name differs from base
{
// ...
}
}
To avoid any ambiguity in the code, a parameter’s name should match the initial declaration, whether its initial declaration is from an interface,
a base class, or a partial method.
abstract class BankAccount
{
void addMoney(int money);
}
class MyBankAccount extends BankAccount
{
void addMoney(int money)
{
// ...
}
}